using ASP;
using HoWave.Common;
using HoWave.Web;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.UI.WebControls;
public class Shop_UserControls_ShowShop : Howave_ControlCache
{
	private int m_num = 10;
	private string m_showType = "text";
	private string m_showFlag = "none";
	private int m_titleLength = 0;
	private string m_styleName = "";
	private string m_place = "";
	private string m_Product = "";
	private string m_classID = "";
	private string m_openType = "_self";
	private string m_showField = "";
	private int m_sortType = -1;
	private string m_commonshop = "";
	private string m_seniorshop = "0";
	private string m_bandshop = "0";
	private DateTime m_regdate;
	private int m_rowNum = 1;
	private string m_othertype = "";
	private string m_fronticon = "";
	private string m_autoUpdate = "false";
	private int m_updateCacheTime = 1;
	private string m_labelName;
	protected Literal ShowShopLiteral;
	public string LabelName
	{
		get
		{
			return this.m_labelName;
		}
		set
		{
			this.m_labelName = value;
		}
	}
	public string AutoUpdate
	{
		get
		{
			return this.m_autoUpdate;
		}
		set
		{
			this.m_autoUpdate = value;
		}
	}
	public int CacheTime
	{
		get
		{
			return this.m_updateCacheTime;
		}
		set
		{
			this.m_updateCacheTime = value;
		}
	}
	public int ShowNum
	{
		get
		{
			return this.m_num;
		}
		set
		{
			this.m_num = value;
		}
	}
	public string ShowUIType
	{
		get
		{
			return this.m_showType;
		}
		set
		{
			this.m_showType = value;
		}
	}
	public string ShowFlag
	{
		get
		{
			return this.m_showFlag;
		}
		set
		{
			this.m_showFlag = value;
		}
	}
	public string CommondShop
	{
		get
		{
			return this.m_commonshop;
		}
		set
		{
			this.m_commonshop = value;
		}
	}
	public string SeniorShop
	{
		get
		{
			return this.m_seniorshop;
		}
		set
		{
			this.m_seniorshop = value;
		}
	}
	public string BandShop
	{
		get
		{
			return this.m_bandshop;
		}
		set
		{
			this.m_bandshop = value;
		}
	}
	public DateTime RegDate
	{
		get
		{
			return this.m_regdate;
		}
		set
		{
			this.m_regdate = value;
		}
	}
	public string StyleName
	{
		get
		{
			return this.m_styleName;
		}
		set
		{
			this.m_styleName = value;
		}
	}
	public string Product
	{
		get
		{
			return this.m_Product;
		}
		set
		{
			this.m_Product = value;
		}
	}
	public string ProductPlace
	{
		get
		{
			return this.m_place;
		}
		set
		{
			this.m_place = value;
		}
	}
	public string ClassID
	{
		get
		{
			return this.m_classID;
		}
		set
		{
			this.m_classID = value;
		}
	}
	public int RowNums
	{
		get
		{
			return this.m_rowNum;
		}
		set
		{
			this.m_rowNum = value;
		}
	}
	public int SortType
	{
		get
		{
			return this.m_sortType;
		}
		set
		{
			this.m_sortType = value;
		}
	}
	public string OpenType
	{
		get
		{
			return this.m_openType;
		}
		set
		{
			this.m_openType = value;
		}
	}
	public string OtherType
	{
		get
		{
			return this.m_othertype;
		}
		set
		{
			this.m_othertype = value;
		}
	}
	public int TitleLength
	{
		get
		{
			return this.m_titleLength;
		}
		set
		{
			this.m_titleLength = value;
		}
	}
	public string ShowField
	{
		get
		{
			return this.m_showField;
		}
		set
		{
			this.m_showField = value;
		}
	}
	public string FrontIcon
	{
		get
		{
			return this.m_fronticon;
		}
		set
		{
			this.m_fronticon = value;
		}
	}
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		base.ControlID = this.ID;
		base.ControlAutoUpdate = this.m_autoUpdate;
		base.UpdateCacheTime = this.m_updateCacheTime;
		string str = base.GetStr();
		if (!string.IsNullOrEmpty(str) && str != "")
		{
			this.ShowShopLiteral.Text = str.Replace("<![CDATA[", "").Replace("]]>", "");
		}
	}
	public override string GetStrFromControl()
	{
		int searchClassID = 0;
		if (this.m_classID != "")
		{
			searchClassID = int.Parse(this.m_classID);
		}
		Conn conn = new Conn();
		Shop_Shop shop_Shop = new Shop_Shop(conn);
		DataTable dataTable = shop_Shop.SearchShopPerPage(this.m_num, 1, 0, "", "", searchClassID, "", this.m_Product, this.m_place, "", this.m_sortType, this.m_commonshop, this.m_seniorshop, this.m_bandshop, this.m_othertype);
		string result;
		if (dataTable != null && dataTable.Rows.Count > 0)
		{
			if (dataTable.Rows.Count < this.m_num)
			{
				this.m_num = dataTable.Rows.Count;
			}
			string text = "";
			if (this.m_styleName != "" && this.m_styleName != null)
			{
				this.m_styleName = "class=\"" + this.m_styleName + "\"";
			}
			string text2 = string.Concat(new string[]
			{
				"<!--缓存时间：",
				DateTime.Now.ToString(),
				"--><ul ",
				this.m_styleName,
				">",
				Environment.NewLine
			});
			string text3 = "";
			if (this.m_showFlag != "none")
			{
				string text4 = this.m_showFlag;
				if (text4 != null)
				{
					if (!(text4 == "hot-icon"))
					{
						if (text4 == "new-icon")
						{
							text3 = "<img src=\"" + text + "Store/Images/new-icon.gif\" border=\"0\"/>";
						}
					}
					else
					{
						text3 = "<img src=\"" + text + "Store/Images/hot-icon.gif\" border=\"0\"/>";
					}
				}
			}
			for (int i = 0; i < this.m_num; i++)
			{
				string text5 = "";
				string text4;
				if (this.m_showField != "")
				{
					string[] array = this.m_showField.Split(new char[]
					{
						'|'
					});
					string[] array2 = array;
					int j = 0;
					while (j < array2.Length)
					{
						string text6 = array2[j];
						text4 = text6;
						if (text4 == null)
						{
							goto IL_3AB;
						}
						string text7;
						if (!(text4 == "ShopRegDate"))
						{
							if (!(text4 == "SalerCrediet"))
							{
								goto IL_3AB;
							}
							text7 = text5;
							text5 = string.Concat(new string[]
							{
								text7,
								"<span class=\"span_",
								text6,
								"\"><script type=\"text/javascript\">if(typeof(displayStar)!=\"undefined\")displayStar(",
								dataTable.Rows[i][text6].ToString(),
								")</script></span>"
							});
						}
						else
						{
							DateTime dateTime = (DateTime)dataTable.Rows[i][text6];
							text7 = text5;
							text5 = string.Concat(new string[]
							{
								text7,
								"<span class=\"span_",
								text6,
								"\">",
								dateTime.ToShortDateString(),
								"</span>"
							});
						}
						IL_422:
						j++;
						continue;
						IL_3AB:
						text7 = text5;
						text5 = string.Concat(new string[]
						{
							text7,
							"<span class=\"span_",
							text6,
							"\">",
							dataTable.Rows[i][text6].ToString(),
							"</span>"
						});
						goto IL_422;
					}
				}
				string text8 = dataTable.Rows[i]["ShopName"].ToString();
				if (this.m_titleLength > 0)
				{
					if (text8.Length > this.m_titleLength)
					{
						text8 = text8.Substring(0, this.m_titleLength);
					}
				}
				string text9 = dataTable.Rows[i]["ShopImageUrl"].ToString();
				if (text9 == null | text9 == "")
				{
					text9 = "/Images/nopicture.gif";
				}
				else
				{
					if (text9.Contains("../"))
					{
						text9 = text9.Replace("../", "");
					}
				}
				string text10 = string.Concat(new string[]
				{
					"<a href=\"",
					text,
					"Store/ShopID=",
					dataTable.Rows[i]["ShopID"].ToString(),
					"\" target=\"",
					this.m_openType,
					"\" title=\"",
					dataTable.Rows[i]["ShopName"].ToString(),
					"\">"
				});
				text4 = this.m_showType;
				if (text4 != null)
				{
					if (!(text4 == "text"))
					{
						if (!(text4 == "img"))
						{
							if (text4 == "imgtext")
							{
								string text7 = text2;
								text2 = string.Concat(new string[]
								{
									text7,
									"<li>",
									text10,
									"<img src=\"",
									text,
									text9,
									"\"title=\"",
									dataTable.Rows[i]["ShopName"].ToString(),
									"\"/></a><p><span class=\"span_title\">",
									text10,
									text8,
									"</a></span>",
									text5,
									text3,
									"</p></li>",
									Environment.NewLine
								});
							}
						}
						else
						{
							string text7 = text2;
							text2 = string.Concat(new string[]
							{
								text7,
								"<li>",
								text10,
								"<img src=\"",
								text,
								text9,
								"\" title=\"",
								dataTable.Rows[i]["ShopName"].ToString(),
								"\"/></a></li>",
								Environment.NewLine
							});
						}
					}
					else
					{
						if (this.m_fronticon != "")
						{
							string text7 = text2;
							text2 = string.Concat(new string[]
							{
								text7,
								"<li><img src=\"",
								text,
								"Images/front_icon/",
								this.m_fronticon,
								"\" />&nbsp;<span class=\"span_title\">",
								text10,
								text8,
								"</a></span>",
								text5,
								text3,
								"</li>",
								Environment.NewLine
							});
						}
						else
						{
							string text7 = text2;
							text2 = string.Concat(new string[]
							{
								text7,
								"<li><span class=\"span_title\">",
								text10,
								text8,
								"</a></span>",
								text5,
								text3,
								"</li>",
								Environment.NewLine
							});
						}
					}
				}
			}
			text2 = text2 + "</ul>" + Environment.NewLine;
			result = text2;
		}
		else
		{
			result = "暂无店铺";
		}
		return result;
	}
}
